"use strict";

import Ajax from "../libs/ajax";
import Constant from "../libs/constants";

const DepartSetting = {
    addDepart(name) {
        let data = {
            action:'1',
            label:name
        }
        return Ajax.ajax({
            url:Constant.URL_ADD_DEPART,
            data:data,
            method:"post"
        }).then(res=>res.data);
    },
    updateDepart(id,name){
        let data = {
            action:'3',
            value:id,
            label:name
        }
        return Ajax.ajax({
            url:Constant.URL_UPDATE_DEPART,
            data:data,
            method:'post'
        }).then(res=>res.data)
    },
    deleteDepart(id){
        let data = {
            action :'2',
            value:id
        }
        return Ajax.ajax({
            url:Constant.URL_DELETE_DEPART,
            data:data,
            method:'post'
        }).then(res=>res.data)
    },
    queryAllDepart(){
        return Ajax.ajax({
            url:Constant.URL_GETALL_DEPART,
            method:'get'
        }).then(res=>res.data)
    }
}

export default DepartSetting